<html>
<body>
Reports non-trivial conditions and values that are statically known to be always true, false, null or zero.
While sometimes intended, often this is a sign of logical error in the program. Additionally,
reports never reachable <code>when</code> branches and some expressions that are statically known to fail always.
<p>Examples:</p>
<pre><code>
fun process(x: Int?) {
  val isNull = x == null
  if (!isNull) {
    if (<span style="background: yellow">x != null</span>) {} // condition is always true
    require(<span style="background: yellow">x!! &lt; 0 && x &gt; 10</span>) // condition is always false
  } else {
    println(x<span style="background: yellow">!!</span>) // !! operator will always fail
  }
}
fun process(v: Any) {
  when(v) {
    is CharSequence -&gt; println(v <span style="background: yellow">as</span> Int) // cast will always fail
    <span style="background: yellow">is String</span> -&gt; println(v) // branch is unreachable
  }
}
</code></pre>
<p>
    Uncheck the "Warn when constant is stored in variable" option to avoid reporting of variables having constant values not in conditions.
</p>
<!-- tooltip end -->
<p><small>New in 2021.3</small></p>
</body>
</html>